/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 *
 * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
 *
 * Contributor(s): 
 *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
 *  
 * If you didn't download this code from the following link, you should check
 * if you aren't using an obsolete version: http://www.isqlviewer.com
 */
package org.isqlviewer.sql;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;

/**
 * TODO Add CallableStatementWrapper Overview JavaDoc.
 * <p>
 * 
 * @author Mark A. Kobold &lt;mkobold at isqlviewer dot com&gt;
 * @version 1.0
 */
public class CallableStatementWrapper extends PreparedStatementWrapper implements CallableStatement {

    private CallableStatement proxy;

    public CallableStatementWrapper(ConnectionWrapper connection, CallableStatement stmt, String currentSQL) {

        super(connection, stmt, currentSQL);
        this.proxy = stmt;
    }

    public Array getArray(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getArray(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getArray(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getArray(int)");
            throw sqle;
        }
    }

    public Array getArray(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getArray(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getArray(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getArray(String)");
            throw sqle;
        }
    }

    public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBigDecimal(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBigDecimal(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBigDecimal(int)");
            throw sqle;
        }
    }

    public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {

        return getBigDecimal(parameterIndex);
    }

    public BigDecimal getBigDecimal(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBigDecimal(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBigDecimal(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBigDecimal(int)");
            throw sqle;
        }
    }

    public Blob getBlob(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBlob(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBlob(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBlob(int)");
            throw sqle;
        }
    }

    public Blob getBlob(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBlob(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBlob(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBlob(String)");
            throw sqle;
        }
    }

    public boolean getBoolean(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBoolean(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBoolean(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBoolean(int)");
            throw sqle;
        }
    }

    public boolean getBoolean(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBoolean(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBoolean(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBoolean(String)");
            throw sqle;
        }
    }

    public byte getByte(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getByte(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getByte(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getByte(int)");
            throw sqle;
        }
    }

    public byte getByte(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getByte(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getByte(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getByte(String)");
            throw sqle;
        }
    }

    public byte[] getBytes(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBytes(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBytes(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBytes(int)");
            throw sqle;
        }
    }

    public byte[] getBytes(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getBytes(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getBytes(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getBytes(String)");
            throw sqle;
        }
    }

    public Clob getClob(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getClob(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getClob(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getClob(int)");
            throw sqle;
        }
    }

    public Clob getClob(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getClob(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getClob(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getClob(String)");
            throw sqle;
        }
    }

    public Date getDate(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDate(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDate(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDate(int)");
            throw sqle;
        }
    }

    public Date getDate(int parameterIndex, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDate(parameterIndex, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDate(int,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDate(int,Calendar)");
            throw sqle;
        }
    }

    public Date getDate(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDate(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDate(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDate(String)");
            throw sqle;
        }
    }

    public Date getDate(String parameterName, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDate(parameterName, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDate(String,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDate(String,Calendar)");
            throw sqle;
        }
    }

    public double getDouble(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDouble(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDouble(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDouble(int)");
            throw sqle;
        }
    }

    public double getDouble(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getDouble(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getDouble(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getDouble(String)");
            throw sqle;
        }
    }

    public float getFloat(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getFloat(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getFloat(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getFloat(int)");
            throw sqle;
        }
    }

    public float getFloat(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getFloat(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getFloat(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getFloat(String)");
            throw sqle;
        }
    }

    public int getInt(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getInt(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getInt(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getInt(int)");
            throw sqle;
        }
    }

    public int getInt(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getInt(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getInt(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getInt(String)");
            throw sqle;
        }
    }

    public long getLong(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getLong(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getLong(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getLong(int)");
            throw sqle;
        }
    }

    public long getLong(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getLong(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getLong(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getLong(String)");
            throw sqle;
        }
    }

    public Object getObject(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getObject(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getObject(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getObject(int)");
            throw sqle;
        }
    }

    public Object getObject(int parameterIndex, Map<String, Class< ? >> map) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getObject(parameterIndex, map);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getObject(int,Map)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getObject(int,Map)");
            throw sqle;
        }
    }

    public Object getObject(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getObject(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getObject(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getObject(String)");
            throw sqle;
        }
    }

    public Object getObject(String parameterName, Map<String, Class< ? >> map) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getObject(parameterName, map);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getObject(String,Map)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getRef(String,Map)");
            throw sqle;
        }
    }

    public Ref getRef(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getRef(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getRef(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getRef(int)");
            throw sqle;
        }
    }

    public Ref getRef(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getRef(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getRef(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getRef(String)");
            throw sqle;
        }
    }

    public short getShort(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getShort(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getShort(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getShort(int)");
            throw sqle;
        }
    }

    public short getShort(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getShort(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getShort(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getShort(String)");
            throw sqle;
        }
    }

    public String getString(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getString(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getString(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getString(int)");
            throw sqle;
        }
    }

    public String getString(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getString(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getString(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getString(String)");
            throw sqle;
        }
    }

    public Time getTime(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTime(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTime(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTime(int)");
            throw sqle;
        }
    }

    public Time getTime(int parameterIndex, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTime(parameterIndex, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTime(int,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTime(int,Calendar)");
            throw sqle;
        }
    }

    public Time getTime(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTime(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTime(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTime(String)");
            throw sqle;
        }
    }

    public Time getTime(String parameterName, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTime(parameterName, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTime(String,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTime(String,Calendar)");
            throw sqle;
        }
    }

    public Timestamp getTimestamp(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTimestamp(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTimestamp(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTimestamp(int)");
            throw sqle;
        }
    }

    public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTimestamp(parameterIndex, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTimestamp(int,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTimestamp(int,Calendar)");
            throw sqle;
        }
    }

    public Timestamp getTimestamp(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTimestamp(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTimestamp(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTimestamp(String)");
            throw sqle;
        }
    }

    public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getTimestamp(parameterName, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getTimestamp(String,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getTimestamp(String,Calendar)");
            throw sqle;
        }
    }

    public URL getURL(int parameterIndex) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getURL(parameterIndex);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getURL(int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getURL(int)");
            throw sqle;
        }
    }

    public URL getURL(String parameterName) throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.getURL(parameterName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "getURL(String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "getURL(String)");
            throw sqle;
        }
    }

    public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterIndex, sqlType);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(int,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(int,int)");
            throw sqle;
        }
    }

    public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterIndex, sqlType, scale);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(int,int,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(int,int,int)");
            throw sqle;
        }
    }

    public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterIndex, sqlType, typeName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(int,int,String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(int,int,String)");
            throw sqle;
        }
    }

    public void registerOutParameter(String parameterName, int sqlType) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterName, sqlType);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(String,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(String,int)");
            throw sqle;
        }
    }

    public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterName, sqlType, scale);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(String,int,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(String,int,int)");
            throw sqle;
        }
    }

    public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.registerOutParameter(parameterName, sqlType, typeName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "registerOutParameter(String,int,String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "registerOutParameter(String,int,String)");
            throw sqle;
        }
    }

    public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setAsciiStream(parameterName, x, length);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setAsciiStream(String,InputStream,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setAsciiStream(String,InputStream,int)");
            throw sqle;
        }
    }

    public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setBigDecimal(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setBigDecimal(String,BigDecimal)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setBigDecimal(String,BigDecimal)");
            throw sqle;
        }
    }

    public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setBinaryStream(parameterName, x, length);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setBinaryStream(String,InputStream,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setBinaryStream(String,InputStream,int)");
            throw sqle;
        }
    }

    public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setCharacterStream(parameterName, reader, length);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setCharacterStream(String,Reader,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setCharacterStream(String,Reader,int)");
            throw sqle;
        }
    }

    public void setBoolean(String parameterName, boolean x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setBoolean(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setBoolean(String,boolean)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setBoolean(String,boolean)");
            throw sqle;
        }
    }

    public void setByte(String parameterName, byte x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setByte(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setByte(String,byte)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setByte(String,byte)");
            throw sqle;
        }
    }

    public void setBytes(String parameterName, byte[] x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setBytes(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setBytes(String,byte[]))"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setBytes(int,bytes[])");
            throw sqle;
        }
    }

    public void setDate(String parameterName, Date x, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setDate(parameterName, x, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setDate(String,Date,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setDate(String,Date,Calendar)");
            throw sqle;
        }
    }

    public void setDate(String parameterName, Date x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setDate(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setDate(String,Date)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setDate(String,Date)");
            throw sqle;
        }
    }

    public void setDouble(String parameterName, double x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setDouble(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setDouble(String,double)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setDouble(String,double)");
            throw sqle;
        }
    }

    public void setFloat(String parameterName, float x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setFloat(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setFloat(String,float)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setFloat(String,float)");
            throw sqle;
        }
    }

    public void setInt(String parameterName, int x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setInt(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setInt(String,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setInt(String,int)");
            throw sqle;
        }
    }

    public void setLong(String parameterName, long x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setLong(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setLong(String,long)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setLong(String,long)");
            throw sqle;
        }
    }

    public void setNull(String parameterName, int sqlType, String typeName) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setNull(parameterName, sqlType, typeName);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setNull(String,int,String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setNull(String,int,String))");
            throw sqle;
        }
    }

    public void setNull(String parameterName, int sqlType) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setNull(parameterName, sqlType);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setNull(String,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setNull(String,int)");
            throw sqle;
        }
    }

    public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setObject(parameterName, x, targetSqlType, scale);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setObject(String,Object,int,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setObject(String,Object,int,int)");
            throw sqle;
        }
    }

    public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setObject(parameterName, x, targetSqlType);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setObject(String,Object,int)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setObject(String,Object,int)");
            throw sqle;
        }
    }

    public void setObject(String parameterName, Object x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setObject(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setObject(String,Object)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setObject(String,Object)");
            throw sqle;
        }
    }

    public void setShort(String parameterName, short x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setShort(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setShort(String,short)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setShort(String,short)");
            throw sqle;
        }
    }

    public void setString(String parameterName, String x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setString(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setString(String,String)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setString(String,String)");
            throw sqle;
        }
    }

    public void setTime(String parameterName, Time x, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setTime(parameterName, x, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setTime(String,Time,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setTime(String,Time,Calendar)");
            throw sqle;
        }
    }

    public void setTime(String parameterName, Time x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setTime(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setTime(String,Time)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setTime(String,Time)");
            throw sqle;
        }
    }

    public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setTimestamp(parameterName, x, cal);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setTimestamp(String,Timestamp,Calendar)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setTimestamp(String,Timestamp,Calendar)");
            throw sqle;
        }
    }

    public void setTimestamp(String parameterName, Timestamp x) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setTimestamp(parameterName, x);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setTimestamp(String,Timestamp)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setTimestamp(String,Timestamp)");
            throw sqle;
        }
    }

    public void setURL(String parameterName, URL val) throws SQLException {

        connection.updateLastAccess();
        try {
            proxy.setURL(parameterName, val);
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "setURL(String,URL)"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "setURL(String,URL)");
            throw sqle;
        }
    }

    public boolean wasNull() throws SQLException {

        connection.updateLastAccess();
        try {
            return proxy.wasNull();
        } catch (SQLException sqle) {
            error(messages.format("DataSource.GeneralMethodError", "wasNull()"), sqle);
            throw sqle;
        } catch (Throwable t) {
            SQLException sqle = connection.createWrappedSQLException(t, "wasNull()");
            throw sqle;
        }
    }
}
